package com.pipi.sso.dao.manager.impl;

import com.pipi.sso.dao.manager.AssetsManager;
import com.pipi.sso.dao.mapper.ext.AssetsExtMapper;
import com.pipi.sso.dao.model.AssetsDO;
import com.pipi.sso.dao.query.AssetsQuery;
import com.pipi.sso.dao.support.PageResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Assets.
 */

@Component
public class AssetsManagerImpl implements AssetsManager {

    
    @Autowired
    protected AssetsExtMapper assetsExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(AssetsQuery query){
        return assetsExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(AssetsQuery query){
        return assetsExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(AssetsDO record){
        return assetsExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(AssetsDO record){
        return assetsExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<AssetsDO> selectByQuery(AssetsQuery query){
        return assetsExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<AssetsDO> selectByQueryWithPage(AssetsQuery query) {
        PageResult<AssetsDO> result = new PageResult<AssetsDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public AssetsDO selectByPrimaryKey(Long id){
        return assetsExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( AssetsDO record,  AssetsQuery query){
        return assetsExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( AssetsDO record,  AssetsQuery query){

        return assetsExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(AssetsDO record){
        return assetsExtMapper.updateByPrimaryKeySelective(record);
    }
}